home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / graphics / 3dvect37.zip / VARS3.INC < prev    next >
Text File  |  1994-06-22  |  14KB  |  391 lines

  1. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  2. ;
  3. ; Filename     : vars3.inc
  4. ; Included from: 3D3.ASM
  5. ; Description  : Defined Variables for 3D3.ASM
  6. ;
  7. ; Written by: John McCarthy
  8. ;             1316 Redwood Lane
  9. ;             Pickering, Ontario.
  10. ;             Canada, Earth, Milky Way (for those out-of-towners)
  11. ;             L1X 1C5
  12. ;
  13. ; Internet/Usenet:  BRIAN.MCCARTHY@CANREM.COM
  14. ;         Fidonet:  Brian McCarthy 1:229/15
  15. ;   RIME/Relaynet: ->CRS
  16. ;
  17. ; Home phone, (905) 831-1944, don't call at 2 am eh!
  18. ;
  19. ; John Mccarthy would really love to work for a company programming Robots
  20. ; or doing some high intensive CPU work.  Hint. Hint.
  21. ;
  22. ; Send me your protected mode source code!
  23. ; Send me your Objects!
  24. ; But most of all, Send me a postcard!!!!
  25. ;
  26. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  27.  
  28.            align 16
  29.  
  30. ; table of current limitations/restraints - to be used as reference by  user
  31. ; at run-time to determine if object code has been assembled with ample room
  32. ; for data/variables/point/surfaces etc...
  33.  
  34. asm_version        dw 30h
  35. asm_maxpoints      dw maxpoints
  36. asm_maxsurfaces    dw maxsurfaces
  37. asm_maxpolys       dw maxpolys
  38. asm_maxobjects     dw maxobjects
  39. asm_number_spaces  dw number_of_spaces
  40. asm_xsize          dw xmax-xmin
  41. asm_ysize          dw ymax-ymin
  42. asm_usez           dw usez
  43. asm_useborders     dw useborders
  44. asm_use_half_stars dw use_half_stars
  45. asm_cameraobject   dw cameraobject
  46. asm_xmode          dw xmode
  47. asm_ratiox         dw ratiox
  48. asm_ratioy         dw ratioy
  49. asm_xactual        dw xactual
  50. asm_yactual        dw yactual
  51. asm_pages          dw pages
  52. asm_shapes         dw numberofshapes
  53. asm_bitmaps        dw numberofbitmaps
  54. asm_xpals          dw numberofpals
  55.  
  56.            align 16
  57.  
  58. objbase    dd numberofshapes dup (0)    ; memory locations of shapes (offsets)
  59. bitbase    dd numberofbitmaps dup (0)   ; memory locations of bitmaps
  60. bitx       dd numberofbitmaps dup (0)   ; x base size of bitmaps (for 3d)
  61. bity       dd numberofbitmaps dup (0)   ; y base size of bitmaps
  62. xreftable  dd numberofpals dup (o nullpalette) ; offsets to palette cross referance tables
  63. stonetbl   dd numberofstones dup (0)    ; offsets to stones textures
  64.  
  65. x1         dw ?                     ; points for line draw
  66. y1         dw ?
  67. x2         dw ?
  68. y2         dw ?
  69. rise       dw ?                     ; counter for draw loop
  70. xp         dd maxpoints dup (?)     ; points breakdown, after rotated, 2d,
  71. yp         dd maxpoints dup (?)     ; x,y points after 3d, are actual location.
  72. zp         dd maxpoints dup (?)     ; z useless, only good during sort of sides
  73. sides      dw maxsurfaces*maxpolys dup (?) ; visible sides only here (clockwize)
  74. order      dd maxsurfaces dup (?)   ; what order to draw surfaces in.
  75. zeds       dd maxsurfaces dup (?)   ; z values of first point in side, for sort
  76. surfcolors dw maxsurfaces dup (?)   ; colours for those sides, high and low
  77. colors12   dd 0                     ; colours for sides 1&2
  78. textures   dw maxsurfaces dup (?)   ; commands/textures for sides
  79. texture12  dd 0                     ; textures for sides 1&2
  80. command    dd 0                     ; current command in load_surfaces loop
  81. showing    dd 0                     ; how many visible sides (total)
  82. pointindex dd 0                     ; indexer to points, xs[],ys[],zs[]
  83. lindex     dd ?                     ; last indexer to points,
  84. offsides   dd offset sides          ; gets inc'd when object plotted
  85. numsides   dd ?                     ; number of sides total, gets trashed
  86. numpoints  dd ?                     ; number of points, gets trashed
  87. whichside  dd ?                     ; which side am i doing now
  88.            dw 0                     ; reserved - leave blank
  89.            tbsize = ymax-ymin
  90.            if tbsize lt xmax-xmin
  91.            tbsize = xmax-xmin
  92.            endif
  93. firstbyte  dw tbsize dup(1000)      ; table of start and end x points
  94.            dw 1000                  ; end flag, permanent
  95.            dw 0                     ; reserved - leave blank
  96. lastbyte   dw tbsize dup(-1000)
  97. oney       dd 1000                  ; y start for one polygon draw
  98. leftmost   dw 1000                  ; only used for fakelineg routine (note g)
  99. colq       db ?                     ; colour of this side
  100. lamflag    db ?                     ; is lambert matrix set up for this object?
  101.            align 16
  102. currobj    dd ?                     ; current object number (for shading)
  103. xupdate    dw xmax,xmin-1           ; x,y update for clearing entire picture
  104. yupdate    dw ymax,ymin-1
  105. lxupdate   dw xmax,xmin-1           ; last x,y update
  106. lyupdate   dw ymax,ymin-1
  107. _old_traces_past dd 0
  108. xad        dd ?                     ; 3d offset of object
  109. yad        dd ?
  110. zad        dd ?
  111. vxcos      dd ?
  112. vxsin      dd ?
  113. vycos      dd ?
  114. vysin      dd ?
  115. vzcos      dd ?
  116. vzsin      dd ?
  117. palxrefx   dd ?                     ; temp xreferance holder
  118. steel      db ?                     ; steel flag, -1 = don't use
  119. steelc     db ?                     ; base colour for steel, taken from colq
  120. polytype   dd ?                     ; offset for polytype (fakeline)
  121. minzc      dd ?                     ; minz (for each object)
  122. btolr      dd ?                     ; tolerance (for each object)
  123. fex        dw ?
  124.  
  125. ; variables for multiple object routine, you modify these!
  126.  
  127.            align 16
  128. xs         dd maxobjects+1 dup (0)  ; locations of objects
  129. ys         dd maxobjects+1 dup (0)
  130. zs         dd maxobjects+1 dup (0)
  131. xadds      dd maxobjects+1 dup (0)  ; linear velocities of objects
  132. yadds      dd maxobjects+1 dup (0)
  133. zadds      dd maxobjects+1 dup (0)
  134. vxs        dw maxobjects+1 dup (0)  ; angles of objects
  135. vys        dw maxobjects+1 dup (0)
  136. vzs        dw maxobjects+1 dup (0)
  137. vxadds     dw maxobjects+1 dup (0)  ; anglular velocities
  138. vyadds     dw maxobjects+1 dup (0)
  139. vzadds     dw maxobjects+1 dup (0)
  140. lcount     dw maxobjects+1 dup (0)  ; linear counter
  141. acount     dw maxobjects+1 dup (0)  ; angular counter
  142. xsfinal    dd maxobjects+1 dup (0)  ; final locations of objects
  143. ysfinal    dd maxobjects+1 dup (0)
  144. zsfinal    dd maxobjects+1 dup (0)
  145. vxsfinal   dw maxobjects+1 dup (0)  ; final angles of objects
  146. vysfinal   dw maxobjects+1 dup (0)
  147. vzsfinal   dw maxobjects+1 dup (0)
  148. whatshape  dw maxobjects+1 dup (0)  ; shapes of objects or bitmaps (0,1,2...)
  149. palxref    db maxobjects+1 dup (0)  ; palette cross reference for each object
  150. userotate  db maxobjects+1 dup (0)  ; rotation type,0 = full,1 = camera
  151.            align 16
  152. onoff      db maxobjects+1 dup (0)  ; is object on/off
  153.  
  154. ; temp strorage for object routine
  155.  
  156.            align 16
  157. finalzed   dw maxobjects dup (?)  ; final z for sort routine
  158. makeorder  dw maxobjects dup (?)  ; order for objects, bubble sorted
  159. zedthis    dd ?                   ; final z temp
  160.  
  161. ; flags to disable/enable routines: disable = -1, enable >=0
  162.  
  163. use_clear  dd yes                 ; flag to use clear_fill routine, default=use
  164. wfollow    dd no                  ; what object are we following, -1 = none
  165. wherelook  dd no                  ; what object do we force camera to look at
  166.  
  167. oldspeed   dd ?                   ; how fast to move, temp counter
  168.  
  169. ; camera variables = was last object in object list, now is zero'th
  170.  
  171. eyex       equ d [xs+cameraobject*4] ; camera location
  172. eyey       equ d [ys+cameraobject*4]
  173. eyez       equ d [zs+cameraobject*4]
  174. eyeax      equ w [vxs+cameraobject*2] ; angles for camera
  175. eyeay      equ w [vys+cameraobject*2]
  176. eyeaz      equ w [vzs+cameraobject*2]
  177. eyexadds   equ d [xadds+cameraobject*4] ; eye location velocity
  178. eyeyadds   equ d [yadds+cameraobject*4]
  179. eyezadds   equ d [zadds+cameraobject*4]
  180. eyevxadds  equ w [vxadds+cameraobject*2] ; eye angular velocities
  181. eyevyadds  equ w [vyadds+cameraobject*2]
  182. eyevzadds  equ w [vzadds+cameraobject*2]
  183. eyelcount  equ w [lcount+cameraobject*2] ; eye linear count (how many times to move)
  184. eyeacount  equ w [acount+cameraobject*2] ; eye angular count
  185. eyefinalx  equ d [xsfinal+cameraobject*4] ; final camera position
  186. eyefinaly  equ d [ysfinal+cameraobject*4]
  187. eyefinalz  equ d [zsfinal+cameraobject*4]
  188. eyefinalax equ w [vxsfinal+cameraobject*2] ; final camera angle
  189. eyefinalay equ w [vysfinal+cameraobject*2]
  190. eyefinalaz equ w [vzsfinal+cameraobject*2]
  191.  
  192.            align 16
  193.  
  194. ecosx      dd ?              ; multipliers of eyeax and eyeaz
  195. esinx      dd ?              ; reset at begining of each new frame
  196. ecosy      dd ?
  197. esiny      dd ?
  198. ecosz      dd ?
  199. esinz      dd ?
  200.  
  201. vcosx      dd ?              ; temp storage for object matrix calculation
  202. vsinx      dd ?              ; can be used if needed during draw
  203. vcosy      dd ?
  204. vsiny      dd ?
  205. vcosz      dd ?
  206. vsinz      dd ?
  207.  
  208. vmatrix    dd 9 dup (?)      ; 3x3 rotation matrix for object (includes eye)
  209. tmatrix    dd 9 dup (?)      ; 3x3 temp rotation matrix for hierarchys
  210. ematrix    dd 9 dup (?)      ; 3x3 rotation matrix for eye
  211. lmatrix    dd 3 dup (?)      ; 1x3 z resultant matrix for lambert shading
  212.  
  213. y_angle_of_sun dd 2000h      ; where is the sun? for shading
  214.  
  215. ; clipping variables in memory locations, pre-calculated!
  216. ; xactual and yactual basically don't change but clipping can to allow
  217. ; windows (rear view mirror, view airplanes menu, auxilary views, rear gunner)
  218. ;
  219. ; when flipping between windows, also flip makeorder[], wfollow, wherelook
  220. ; oldspeed, lxupdate, lyupdate, camera variables/angles/speeds (obviously).
  221.  
  222. cliplt      dw xcenter+xmin     ; xcenter+xmin
  223. cliprt      dw xcenter+xmax-1   ; xcenter+xmax-1
  224. cliptp      dw ycenter+ymin     ; ycenter+ymin
  225. clipbt      dw ycenter+ymax-1   ; ycenter+ymax-1
  226.  
  227. xcent       dw xcenter
  228. ycent       dw ycenter
  229. ycents1     dw ycenter-1
  230. ycentp1     dw ycenter+1
  231.  
  232. xmaxxcent   dw xmax+xcenter
  233.  
  234. ymaxycent   dw ymax+ycenter
  235.  
  236. xmins       dw xmin
  237. xmins1      dw xmin-1
  238. xmaxs       dw xmax
  239. xmaxs1      dw xmax-1
  240.  
  241. ymins       dw ymin
  242. ymins1      dw ymin-1
  243. ymaxs       dw ymax
  244. ymaxs1      dw ymax-1
  245.  
  246. xmit        dd xmin-tolerance   ; tolerance is max object size/ratio
  247. xmat        dd xmax+tolerance
  248. ymit        dd ymin-tolerance
  249. ymat        dd ymax+tolerance
  250.  
  251. ; variables for icon scale routine
  252.  
  253. bitmap        dd ?
  254. destwidth     dw ?
  255. destheight    dw ?
  256. destx         dw ?
  257. desty         dw ?
  258.  
  259. sourcewidth   dw ?              ; workspace for icon scale routine
  260. sourceheight  dw ?
  261. decisionx     dw ?
  262. decisiony     dw ?
  263. clippedwidth  dw ?
  264. clippedheight dw ?
  265.  
  266. background dw 0                 ; background colour, must be in high and low!
  267.  
  268.            public objbase    ; make sure these are here even if you don't
  269.            public bitbase    ; use them.  tlink will fail if not present.!
  270.            public bitx
  271.            public bity
  272.            public xreftable
  273.            public stonetbl
  274.  
  275.            public xs
  276.            public ys
  277.            public zs
  278.            public xadds
  279.            public yadds
  280.            public zadds
  281.            public vxs
  282.            public vys
  283.            public vzs
  284.            public vxadds
  285.            public vyadds
  286.            public vzadds
  287.            public xsfinal
  288.            public ysfinal
  289.            public zsfinal
  290.            public vxsfinal
  291.            public vysfinal
  292.            public vzsfinal
  293.            public lcount
  294.            public acount
  295.            public whatshape
  296.            public userotate
  297.  
  298.            public eyex
  299.            public eyey
  300.            public eyez
  301.            public eyeax
  302.            public eyeay
  303.            public eyeaz
  304.            public eyexadds
  305.            public eyeyadds
  306.            public eyezadds
  307.            public eyevxadds
  308.            public eyevyadds
  309.            public eyevzadds
  310.            public eyefinalx
  311.            public eyefinaly
  312.            public eyefinalz
  313.            public eyefinalax
  314.            public eyefinalay
  315.            public eyefinalaz
  316.            public eyelcount
  317.            public eyeacount
  318.  
  319.            public onoff
  320.  
  321.            public vmatrix
  322.            public tmatrix
  323.            public ematrix
  324.            public lmatrix
  325.            public y_angle_of_sun
  326.  
  327.            public background
  328.  
  329.            public bitmap
  330.            public destwidth
  331.            public destheight
  332.            public destx
  333.            public desty
  334.  
  335.            public use_clear
  336.            public wfollow
  337.            public wherelook
  338.  
  339.            public x1
  340.            public y1
  341.            public x2
  342.            public y2
  343.            public colq
  344.            public steel
  345.  
  346.            public lxupdate
  347.            public lyupdate
  348.            public xupdate
  349.            public yupdate
  350.            public makeorder
  351.            public oney
  352.            public firstbyte
  353.            public lastbyte
  354.            public showing
  355.            public _old_traces_past
  356.  
  357.            public cliplt
  358.            public cliprt
  359.            public cliptp
  360.            public clipbt
  361.            public xcent
  362.            public ycent
  363.            public xmins
  364.            public xmins1
  365.            public xmaxs
  366.            public xmaxs1
  367.            public ymins
  368.            public ymins1
  369.            public ymaxs
  370.            public ymaxs1
  371.  
  372.            public asm_version
  373.            public asm_maxpoints
  374.            public asm_maxsurfaces
  375.            public asm_maxpolys
  376.            public asm_maxobjects
  377.            public asm_number_spaces
  378.            public asm_xsize
  379.            public asm_ysize
  380.            public asm_usez
  381.            public asm_useborders
  382.            public asm_use_half_stars
  383.            public asm_cameraobject
  384.            public asm_xmode
  385.            public asm_ratiox
  386.            public asm_ratioy
  387.            public asm_xactual
  388.            public asm_yactual
  389.            public asm_pages
  390.  
  391.